include $(TOPDIR)/rules.mk

PKG_NAME:=8ms
PKG_VERSION=v2.0
PKG_RELEASE:=1

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=https://github.com/wireless-tag-com/8ms-sigmastar.git
PKG_SOURCE_VERSION:=327aa476deb370bd6be5d2b01f4d5a1eaea1478b
#PKG_MIRROR_HASH:=8d2c70fb0264a6548e39acc5ab1c44cec50fc550c4f931760b0796f8893c9b7f

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
  SECTION:=qmsd
  CATEGORY:=qmsd
  SUBMENU:=libs
  DEPENDS:=+libopenssl +libubox +libubus +libblobmsg-json +libcjson +libwtinfo +libfreetype +TARGET_sstar_ssd20x:ssd20x-mpp-lib +TARGET_sstar_ssd21x:ssd21x-mpp-lib
  TITLE:=qmsd 8ms
endef

define Package/$(PKG_NAME)/description
 qmsd 8ms.
endef

TARGET_CFLAGS += -D_GNU_SOURCE

define Build/Configure
endef

MAKE_FLAGS += UBUS=y CHIP=$(SUBTARGET)

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/lib
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/extra/lib/$(SUBTARGET)/liblvgl.so $(1)/usr/lib/liblvgl.so
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/extra/lib/$(SUBTARGET)/liblvfreetype.so $(1)/usr/lib/liblvfreetype.so
endef

define Package/$(PKG_NAME)/install
	$(INSTALL_DIR) $(1)/usr/lib $(1)/usr/sbin
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/extra/lib/$(SUBTARGET)/liblvgl.so $(1)/usr/lib/liblvgl.so
	$(INSTALL_DATA) $(PKG_BUILD_DIR)/extra/lib/$(SUBTARGET)/liblvfreetype.so $(1)/usr/lib/liblvfreetype.so
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/qmsd-demo $(1)/usr/sbin/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
